home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: Aug 15 1996
- //
- // Description:
- // This script initializes the Command line. Initialization involves
- // determining the initial Command line preferences, creating the UI
- // and setting the initial visibility.
- //
- {
- // Declare referenced or returned globals.
- //
- global string $gCommandWindow;
- global string $gCommandLineForm;
- global string $gCommandLine;
-
- // Create a layout appropriate for the Command line.
- //
- string $commandLineForm = `formLayout -parent $gCommandLineForm`;
-
- // Now actually create the Command line.
- //
- // MAYAMACTODO - This is a temporary fix to make the command line's
- // visibility a bit more. There seems to be some layout problem else where.
-
- if(`about -mac`){
- $gCommandLine = `commandLine
- -height 30
- -enterCommand "setFocus $gCommandLine"
- -inputAnnotation "Command Line: Enter MEL commands"
- -outputAnnotation "Command Feedback: Displays the command response (Open Script Editor to display more of the history)"`;
-
- }else{
- $gCommandLine = `commandLine
- -enterCommand "setFocus $gCommandLine"
- -inputAnnotation "Command Line: Enter MEL commands"
- -outputAnnotation "Command Feedback: Displays the command response (Open Script Editor to display more of the history)"`;
- }
-
- if(`optionVar -exists commandLineInputFieldWidth`)
- paneLayout -e -ps 1 `optionVar -q commandLineInputFieldWidth` 100 $gCommandLine;
-
- if(`optionVar -exists commandLineNumHistoryLines`)
- commandLine -e -numberOfHistoryLines `optionVar -q commandLineNumHistoryLines` $gCommandLine;
-
- // If the hold focus preference is not set then attach a
- // command to send focus back to the view panes.
- //
- int $holdFocus = `optionVar -query commandLineHoldFocus`;
- if (!$holdFocus) {
- commandLine -edit
- -command "setFocus `paneLayout -query -pane1 viewPanes`"
- $gCommandLine;
- }
-
- // The "show the Command window" button.
- //
- string $iconButton = `symbolButton
- -image "cmdWndIcon.xpm"
- -annotation "Script Editor"
- -command "showWindow $gCommandWindow"`;
-
- // For improving the alignment of the button.
- //
- int $topSpacing, $bottomSpacing;
- if (`about -nt`) {
- $topSpacing = 1;
- $bottomSpacing = 1;
- } else if(`about -mac`) {
- $topSpacing = 1;
- $bottomSpacing = 8;
- } else {
- $topSpacing = 0;
- $bottomSpacing = 1;
- }
-
- // Layout Command line contents.
- //
- formLayout -edit
- -attachForm $gCommandLine "top" 0
- -attachForm $gCommandLine "left" 0
- -attachForm $gCommandLine "bottom" 0
- -attachControl $gCommandLine "right" 0 $iconButton
-
- -attachForm $iconButton "top" $topSpacing
- -attachNone $iconButton "left"
- -attachForm $iconButton "bottom" $bottomSpacing
- -attachForm $iconButton "right" 0
- $commandLineForm;
-
- // Attach Command line to parent.
- //
- formLayout -edit
- -attachForm $commandLineForm "top" 0
- -attachForm $commandLineForm "left" 0
- -attachForm $commandLineForm "bottom" 0
- -attachForm $commandLineForm "right" 0
- $gCommandLineForm;
-
- setUIComponentStateCallback(
- "Command Line", "commandLineVisibilityStateChange");
-
- // Set the Command line's initial visibility.
- //
- setCommandLineVisible(`optionVar -query commandLineVisible`);
- }
-
- global proc int commandLineVisibilityStateChange(
- int $newState,
- string $layout)
- //
- // Description:
- // This procedure is called whenever the visibility state of the
- // Command Line is changed.
- //
- // Arguments:
- // newState - The new visibile state of the Command Line.
- //
- // layout - The parent layout for the Command Line.
- //
- // Returns:
- // true - If the change of state is to be allowed.
- //
- // false - If the state change is rejected.
- //
- {
- int $result = true;
-
- // Defer these commands because this proc is called when the visibility
- // state is about to change. This proc must return true to accept
- // the state change. After this proc returns then restore the
- // panel focus and update the pref menu.
- //
- evalDeferred("restoreLastPanelWithFocus(); updatePrefsMenu();");
-
- return $result;
- }
-